/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.compomics.seedlistgenerator;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.apache.log4j.Logger;

/**
 * @author Jonas
 */
public class JDBCConnection {
    
    private static final Logger LOGGER = Logger.getLogger(JDBCConnection.class);
    
    // Variables to hold the credentials for the database-connection
    private String username;
    private String password;
    private String connectionString;
    
    public JDBCConnection (String username, String password, String connectionString){
        this.username = username;
        this.password = password;
        this.connectionString = connectionString;
    }
    
    public Connection getDatabaseConnection(){
        
        Connection con = null;
        
        try {
            con = ((Connection) DriverManager.getConnection(connectionString, username, password));
        } catch (SQLException e){
            LOGGER.error(e.getMessage());
        }
        
        return con;
    }
    
    
}
